﻿#region Copyright 2008 - Evolution Systems.
//
// Author: José Rogério Ferreira dos Santos(joserogerio.santos@gmail.com)
// Date: 11/01/2009
// Time: 14:42
// All rights are reserved. Reproduction or transmission in whole or in part, in
// any form or by any means, eletronic, mechanical or otherwise, is prohibited
// without the prior written permission of the author.
//
// Filename: ${FILE_NAME}.cs
#endregion
using System;
using System.Collections.Generic;
using ComponentFactory.Krypton.Toolkit;

namespace csharp.rad.finan
{
	/// <summary>
	/// Description of Functions.
	/// </summary>
	public class Functions
	{
		public static void fillComboGroups(Groups list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}
		
		public static void fillComboSubGroups(SubGroups list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}	
		
		public static void fillComboClass(Classs list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}		

		public static void fillComboSubClass(SubClasss list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}			
		
		public static void fillComboBill(Bills list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}			
		
		public static void fillComboBank(Banks list, KryptonComboBox cmb, String valueMember, String diplayMember)
		{
			cmb.Items.Clear();
			for(int i=0; i < list.count(); i++)
				cmb.Items.Add(list.get(i));
			cmb.ValueMember= valueMember;
			cmb.DisplayMember = diplayMember;
		}		
		
		public static void setSelectIndexComboGroup(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as Group).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}	
		
		public static void setSelectIndexComboSubGroup(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as SubGroup).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}	
		
		public static void setSelectIndexComboClass(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as Class).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}	
		
		public static void setSelectIndexComboSubClass(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as SubClass).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}	
		
		public static void setSelectIndexComboBill(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as Bill).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}				
	
		public static void setSelectIndexComboBank(KryptonComboBox cmb, String value)
		{
			for (int i=0; i < cmb.Items.Count; i++)
				if (value.Equals((cmb.Items[i] as Bank).id))
				{
					cmb.SelectedIndex= i;
					break;
				}					
		}						
	}
}
